package com.topcoder.tcoc10;

import java.util.Arrays;

public class EvaluatingElections {
	public int evaluate(int[] districts) {
		int N = districts.length;
		Arrays.sort(districts);
		int sum = 0;
		int min = 0;
		
		for (int i=0; i<N; i++) {
			sum += districts[i];
		}
		
		boolean even = false;
		for (int i=0; i<N/2; i++) {
			min += districts[i]/2 + 1;
			if (districts[i]%2 == 0) even = true;
		}
		
		if (N%2 == 1) {
			int mid = (N-1)/2;
			min += districts[mid]/2 + 1;
			if (districts[mid]%2 == 0 || even) min--;
		}
		
		return sum - min + 1;
	}
}
